package com.tms.app.tms.ui.home.msg;


import com.tms.app.tms.app.Constant;
import com.tms.app.tms.ui.base.presenter.AbsServicexUtils;
import com.tms.app.tms.adapter.OrderAdapter;
import com.tms.app.tms.bean.TestBean;

import org.xutils.http.RequestParams;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by happy on 2017/8/28.
 */

public class OrderP extends AbsServicexUtils {
    List<TestBean> list= new ArrayList<>();
    IViewTrade iViewTrade;
    public void setiView(IViewTrade iViewTrade) {
        this.iViewTrade = iViewTrade;
        initTestData();
    }

    @Override
    public void onSuccess(String result) {
        super.onSuccess(result);
    }

    private void bindDataToView(){
        if (iViewTrade==null)
            return;
        OrderAdapter depthAdapter= iViewTrade.getAdapter(0);
        depthAdapter.getData().clear();
        depthAdapter.getData().addAll(list);
        depthAdapter.notifyDataSetChanged();
    }

    public void initTestData(){
        for (int i = 0; i < 10; i++) {
            TestBean testBean=new TestBean();
            testBean.setName("功能"+i);
            list.add(testBean);
        }
        bindDataToView();
    }



    public void getDepthInfo(String sybmol, String type){
        RequestParams params=new RequestParams(Constant.BASE_URL);
       // params.addBodyParameter("accessToken",audio.getAccessToken());
        params.addBodyParameter("symbol",sybmol);//	ethcny, etccny, bcccny, ethbtc, ltcbtc, etcbtc, bccbtc
        params.addBodyParameter("type",type);//	step0, step1, step2, step3, step4, step5（合并深度0-5）；step0时，不合并深度
        getObjectFromServer(params);
    }


}
